/**
 * 描述: 服务-提现管理
 * 版权: Copyright (c) 2019
 * 公司: 深圳市网商天下科技开发有限公司
 * 作者: 许堉颖
 * 版本: 1.0.0
 * 创建时间: 2019/04/29 16:52
 */
import {Service, RequestParams} from 'vue-element-simple';

// ====================提现管理
/**
 * 分页获取提现列表
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationGetWithdrawList = async function (params = {}) {
  const request = new RequestParams();
  // 页数
  request.put('page', params['page'], 1);
  // 每页条数
  request.put('pageSize', params['pageSize'], 20);
  // 模糊搜索
  request.put('search', params['search']);
  // 开始时间
  request.put('timeFrom', params['timeFrom']);
  // 结束时间
  request.put('timeTo', params['timeTo']);
  // 类型
  request.put('type', params['type']);
  // 状态
  request.put('status', params['status']);
  return await this.getService(`/admin/transfer/getPageList`, request);
};

/**
 * 获取提现规格
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationGetWithdrawRules = async function () {
  const request = new RequestParams();
  return await this.getService(`/admin/system/getConfig/withdraw`, request);
};

/**
 * 更新提现规格
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationUpdateWithdrawRules = async function (params = {}) {
  const request = new RequestParams();
  // 每天提现次数
  request.put('withdrawNum', params['withdrawNum']).checkEmpty('每天提现次数');
  // 提现最大值
  request.put('withdrawMax', params['withdrawMax']).checkEmpty('提现最大值');
  // 提现最小值
  request.put('withdrawMin', params['withdrawMin']).checkEmpty('提现最小值');
  // 提现最大值状态
  request.put('withdrawMaxStatus', params['withdrawMaxStatus']).checkEmpty('提现最大值状态');
  // 提现最小值状态
  request.put('withdrawMinStatus', params['withdrawMinStatus']).checkEmpty('提现最小值状态');
  return await this.getService(`/admin/system/saveConfig/withdraw`, request);
};

/**
 * 删除提现申请
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationDeleteWithdrawApply = async function (params = {}) {
  const request = new RequestParams();
  // id
  request.put('id', params['id']).checkEmpty('id');
  return await this.getService(`/admin/transfer/delete`, request);
};

/**
 * 更新提现申请状态
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationUpdateWithdrawStatus = async function (params = {}) {
  const request = new RequestParams();
  // id
  request.put('id', params['id']).checkEmpty('id');
  // 状态
  request.put('status', params['status']).checkEmpty('状态');
  return await this.getService(`/admin/transfer/changeStatus`, request);
};
// ====================提现管理
